package design.pattern.Lu14IteratorPattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @program JavaBase
 * @description: 不使用迭代器模式
 * @author: zhanglu
 * @create: 2020-04-09 17:34:00
 */
public class NoIteratorPattern {

    public static void main(String[] args) {

        List<Project> projectList = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            projectList.add(new Project("项目" + i, i));
        }

        projectList.stream().forEach(o -> System.out.println(o.projectInfo()));

    }

}

interface IProject{
    String projectInfo();
}

class Project implements IProject{

    private String name;
    private Integer count;

    public Project(String name, Integer count){
        this.name = name;
        this.count = count;
    }

    @Override
    public String projectInfo() {
        String str = "项目名称：" + name + "\t项目数量：" + count;
        return str;
    }
}
